#![no_std]
#![no_main]
#![feature(pointer_is_aligned_to)]
#![feature(naked_functions)]
#![feature(panic_can_unwind)]
#![allow(undefined_naked_function_abi)]

extern crate alloc;

mod io;
mod kernel_hal;
#[macro_use]
mod logging;
mod example;
mod homework;
mod mimalloc;
mod uart;

use crate::{example::example_4_1, homework::dum_stack};
use core::{arch::global_asm, panic::PanicInfo};

global_asm!(include_str!("boot.s"));

#[panic_handler]
fn panic_handler(info: &PanicInfo) -> ! {
    println!("panic_handler: {:?}", info);

    loop {}
}

// kernel_main不能返回.
#[unsafe(no_mangle)]
fn kernel_main() {
    println!("欢迎来到我的世界");
    example_4_1();
    dum_stack();
    loop {
        continue;
    }
}
